<template>
	<view>
		<view v-if="tzType == 1">
			{{title}}秒后跳转支付...
		</view>
		<view v-else>
			<span @click="manual" plain="true"><h3>点我手动跳转</h3></span>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: 'https://cn.bing.com',
				title:5,
				tzType:1,//跳转状态
			}
		},
		methods: {
			auto() {
				let _this = this;
				let timer = 5

				let timer1 = setInterval(() => {
					timer--;
					_this.title = timer
					if (timer == 0) {
						clearInterval(timer1);
						timer = 5;
						_this.title = timer;
						window.location.href = _this.url;//重定向到支付页面
						_this.tzType = 0;
						return;
					}
				}, 1000);
			},
			manual(){
				window.location.href = this.url;
			}
		},
		onLoad(p) {
			let _this = this;
			console.log(p.url)
			if(!p.url){
				_this.url = 'http://h5.yunshuicha.com'
			}else{
				_this.url = p.url;
			}
			this.auto()
		}
	}
</script>


<style>
</style>
